HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP
HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP
am 05.10.2007 06:29:31 von james.n.grace
I am trying to make the contents of a Web visitor's shopping cart
available via email, but can't get anything more than the final item
in their cart to display in the subsequent email. Changing the HTML
form method from the normal "post" to "get" yields the following in
the URL stream (I added carriage returns after each "&" to make things
easier to read):
As you can see, the shopping cart items are repeated with the same
"FileName", "DirPath", "RIDValue", and "Description" when they are
sent to the PHP page.
The PHP page which receives the form data is as follows:
Anyway, the initial rewrite from ASP to PHP was quite easy.
Unfortunately, the final part is turning out to be much more of a
challenge!
Thanks in advance for your time and effort!
Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite fromASP
am 05.10.2007 14:30:20 von Jerry Stuckle
james.n.grace@gmail.com wrote:
> I am trying to make the contents of a Web visitor's shopping cart
> available via email, but can't get anything more than the final item
> in their cart to display in the subsequent email. Changing the HTML
> form method from the normal "post" to "get" yields the following in
> the URL stream (I added carriage returns after each "&" to make things
> easier to read):
>
First of all, what's the form that's sending the data look like?
It helps to start at the beginning, instead of midway through a problem :-)
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP
am 05.10.2007 15:43:43 von james.n.grace
The form is very lengthy, but here is the pertinent form code:
- - - - - - - - - - S N I P - - - - - - - - - -
Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP
am 05.10.2007 15:57:47 von luiheidsgoeroe
On Fri, 05 Oct 2007 15:43:43 +0200, james.n.grace@gmail.com =
wrote:
> The form is very lengthy, but here is the pertinent form code:
>
>
> - - - - - - - - - - S N I P - - - - - - - - - -
>
> email_form_send.php" method=3D"post" name=3D"EmailForm" id=3D"EmailFor=
m">
>
>
>
>
>
FileName
> %>">
>
DirPath
> %>">
>
RIDValue
> %>">
So I assume these three are repeated? On a post, avery subsequent post =
field with the same name would overwrite the previous one in the 'magic'=
=
$_POST array. To keep the form the same would require parsing php://inpu=
t =
yourself (or $HTTP_RAW_POST_DATA). Not a very pleasant task.
If you can change the fieldnames in the form itself, add '[]' to the =
repeated fields, like:
">
In the receiving script you could do this:
if(is_array($_POST['FileName']) && !empty($_POST['FileName'])){
foreach($_POST['FileName'] as $key =3D> $value){
//do your thing
echo "$key: {$_POST['FileName'][$key]} {$_POST['DirPath'][$key]} =
{$_POST['RIDValue'][$key]}\n";
}
}
-- =
Rik Wasmus
Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP
am 05.10.2007 16:38:02 von james.n.grace
Hooray -- that worked perfectly!
THANKS!!!
On Oct 5, 9:57 am, "Rik Wasmus" wrote:
> If you can change the fieldnames in the form itself, add '[]' to the
> repeated fields, like:
>
>
> In the receiving script you could do this:
>
>
>
> if(is_array($_POST['FileName']) && !empty($_POST['FileName'])){
> foreach($_POST['FileName'] as $key => $value){
> //do your thing
> echo "$key: {$_POST['FileName'][$key]} {$_POST['DirPath'][$key]}
> {$_POST['RIDValue'][$key]}\n";
> }}
>
> --
> Rik Wasmus